<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>综合训练：输出1~1000质数</title>
</head>
<body>
	<h1 style="">1~1000质数如下：</h1>
	<%@ page import="java.util.*,java.text.*"%>
	<%!public boolean isPrime(int num) {
		for (int j = 2; j < num; j++) {
			if (num % j == 0) {
				return false;
			}
		}
		return true;
	}%>
	<%
	List<Integer> primeNums = new ArrayList();
	for (int i = 2; i < 1000; i++) {
		if (isPrime(i)) {
			primeNums.add(i);
		}
	}
	%>
	<%
	out.println("利用List");
	for (int p : primeNums) {
		//out.println("<h3>"+ p +"</h3>");
	%>
	<h3 style="color: red">
		<%=p%>
	</h3>
	<%
	}
	%>
</body>
</html>